<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/style.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/layui.css">
</head>
<body>

<div class="danpin center">
    <div class="main center" style="height: auto" id="spzs">
        <c:forEach items="${sessionScope.someBook}" var="obj" >
            <div class="mingxing fl dgsp" style="margin-top: 5px">
                <div class="sub_mingxing"><a <%--href=""--%>><img src="${obj.get("url")}" alt=""></a></div>
                <div class="pinpai"><a <%--href=""--%>>${obj.get("bookname")}</a></div>
                <div class="youhui">${obj.get("remark")}</div>
                <div class="jiage">${obj.get("price")}</div>
                <input type="hidden" id="bookid" name="bookid" value="${obj.get("bookid")}">
            </div>
        </c:forEach>
        <div class="clear"></div>
    </div>
</div>

</body>

<script src="${pageContext.request.contextPath}/layui/layui.all.js" charset="utf-8"></script>

<script>
    layui.use(['carousel','form','jquery'], function(){
        var carousel = layui.carousel
        var form = layui.form;
        var $ = layui.jquery;

        function showbookxq() {
            $("#spzs .dgsp").click(function () {
                //alert($(this).children("input").val()); 取到 点击的这个 div 的 bookid 的值
                $.ajax({
                    type:'post',
                    url:'${pageContext.request.contextPath}/book/showBookByBookid',
                    data:{"bookid":$(this).children("input").val()},
                    //dataType:'json',//预期的后台数据类型
                    success:function (data) {
                        window.location.href='${pageContext.request.contextPath}/showbookxq.jsp';
                    }
                })
            })
        }

        $(function () {
            showbookxq();
        })
    });
</script>
</html>
